package com.base.helper;

import com.base.comm.CommUrls;
import com.base.utils.Md5Encrypt;
import com.base.utils.Produce;

public class SmsHelper {

	/**
	 * 发送短信
	 * 
	 * @param _phone
	 * @param num
	 * @param layid
	 * @param signid
	 * @param type
	 * @return
	 * @throws Exception
	 */
	public static String SendSms(String _phone, Object num, String layid, String signid, int type) throws Exception {
		String data = "";
		if (type == 1) {
			String s = Produce.getNowDate().getTime() + "";
			String w = Md5Encrypt.Bit32(CommUrls.Smsaccountid + CommUrls.Smsappid + CommUrls.Smsappkey + s);
			data = "accountid=" + CommUrls.Smsaccountid + "&&appid=" + CommUrls.Smsappid + "&&appkey="
					+ CommUrls.Smsappkey + "&&phone=" + _phone + "&&timeline=" + s + "&&template_id=" + layid
					+ "&&params=" + num + "&&sign_id=" + signid + "&&sign=" + w + "";

		}
		if (type == 2) {
			String s = Produce.getNowDate().getTime() + "";
			String w = Md5Encrypt.Bit32(CommUrls.Smsaccountidzy + CommUrls.Smsappkeyzy + s);
			data = "{\"apiAccount\":\"" + CommUrls.Smsaccountidzy + "\",\"appId\":\"" + CommUrls.Smsappidzy
					+ "\",\"sign\":\"" + w + "\",\"timeStamp\":\"" + s + "\",\"templateId\":\"" + layid
					+ "\",\"singerId\":\"" + signid + "\",\"mobile\":\"" + _phone + "\",\"param\":\"" + num + "\"}";
		}
		return data;
	}

	public static void main(String[] args) {

	}
}
